package com.chandra.pos.common.utils;

import com.chandra.pos.common.model.POSConstant;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;

import java.io.IOException;

/**
 * Created by dnagarajan on 4/12/2015.
 */
public class JodaDateTimeJsonSerializer extends JsonSerializer<DateTime> {





    @Override
    public void serialize(final DateTime value, final JsonGenerator gen, final SerializerProvider arg2)
            throws IOException, JsonProcessingException {
        if (value != null) {
            gen.writeString(DateUtils.format(value));
        }
    }
}